<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
    <link href="/assets/index/css/mui/mui.min.css" rel="stylesheet" />
    <script src="/assets/index/js/mui.min.js"></script>
    <script src="/assets/index/js/echarts-all.js"></script>

    
    <style>
         body {
        margin: 0;
        padding: 0;
        font-family: 'Microsoft YaHei';
        background-color: rgb(245, 245, 245);
    }

    img {
        width: 100%;
    }

    h1 {
        text-align: center;
        line-height: 20px;
    }

    .weui-article {
        padding: 5px 15px;
    }

    small {
        color: #0b720b;
    }

    h2 {
        color: #0b720b;
    }
    .chart {
    height: 200px;
    margin: 0px;
    padding: 0px;
        }
    </style>
    <title>联系我们</title>
</head>
<body>
    <div class="mui-content">
        <div id="slider" class="mui-slider">
            <div class="mui-slider-group mui-slider-loop">
                <!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
                <div class="mui-slider-item mui-slider-item-duplicate">
                    <a href="#">
                        <img src="\assets\index\images\video4.png">
                        <p class="mui-slider-title">web前端开发</p>
                    </a>
                </div>
                {foreach $toplist as $img}
                <div class="mui-slider-item">
                    <a href="#">
                        <img src="{$img['thumbs']}">
                        <p class="mui-slider-title">{$img['title']}</p>
                    </a>
                </div>
                {/foreach}
                <!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
                <div class="mui-slider-item mui-slider-item-duplicate">
                    <a href="#">
                        <img src="\assets\index\images\video2.png">
                        <p class="mui-slider-title">React实战模拟</p>
                    </a>
                </div>
            </div>
            <div class="mui-slider-indicator mui-text-right">
                <div class="mui-indicator mui-active"></div>
                <div class="mui-indicator"></div>
                <div class="mui-indicator"></div>
                <div class="mui-indicator"></div>
                <div class="mui-indicator"></div>
            </div>
        </div>
    </div>
    <div class="mui-content-padded">
        <h5>线图示例</h5>
        <div class="chart" id="lineChart" style="margin-top: 10px;"></div>
    </div>
</body>
</html>
<script src="/assets/index/js/jquery-1.9.1.min.js"></script>
<script>
    $.ajax({
        url:`/index/business/Business/analysis_echarts`,
        type:'post',
        dataType:'json',
        success:function(success){
            console.log(success.data);
            var order = success.data.order_total
            var record = success.data.record_total
            console.log(order);
            console.log(record);
            var getOption = function(chartType) {
                var chartOption = chartType =  {
                    legend: {
                        data: ['消费记录', '购买记录']
                    },
                    grid: {
                        x: 35,
                        x2: 10,
                        y: 3,
                        y2: 25
                    },
                    toolbox: {
                        show: false,
                        feature: {
                            mark: {
                                show: true
                            },
                            dataView: {
                                show: true,
                                readOnly: false
                            },
                            magicType: {
                                show: true,
                                type: ['line', 'bar']
                            },
                            restore: {
                                show: true
                            },
                            saveAsImage: {
                                show: true
                            }
                        }
                    },
                    calculable: false,
                    xAxis: [{
                        type: 'category',
                        data: success.data.month
                    }],
                    yAxis: [{
                        type: 'value',
                        splitArea: {
                            show: true
                        }
                    }],
                    series: [{
                        name: '消费记录',
                        type: chartType,
                        data: order
                    }, {
                        name: '购买记录',
                        type: chartType,
                        data: record
                    }]
                        };
                        return chartOption;
                    };
                    var byId = function(id) {
                        return document.getElementById(id);
                    };
                    var lineChart = echarts.init(byId('lineChart'));
                    lineChart.setOption(getOption('line'));
        },
    })
        // byId("echarts").addEventListener('tap',function(){
        //     var url = this.getAttribute('data-url');
        //     plus.runtime.openURL(url);
        // },false);
</script>


